#pragma once
#ifndef SKITTER_H_
#define SKITTER_H_
#include "Btree3D.h"
#include "Variation.h"
#include <map>
#include <array>

#define NUM_BUF_VAR 2
#define NUM_WIRE_VAR 2
#define NUM_TSV_VAR 2

namespace Cxuh{

	class skitter
	{
	public:
		skitter(Btree3D* tree1);
		void gen_variation(const BtreeNode* rt, const int clk_edge); // generate variation list for each node
		void model(); // model the skitter
		~skitter(void);

		static std::array<std::string, NUM_BUF_VAR> buf_var_types;
		static std::array<std::string, NUM_WIRE_VAR> wire_var_types;
		static std::array<std::string, NUM_TSV_VAR> tsv_var_types;
	private:
		Btree3D* tree;	
		std::map<std::string, Variation*> dvar_buf_set[2]; // delay variations related to buffers, for 1st and 2nd clock edges
		std::map<std::string, Variation*> dvar_wire_set[2]; // delay variations related to wires, including TSVs
		std::map<std::string, Variation*> tvar_buf_set[2]; // transition variations related to buffers
		std::map<std::string, Variation*> tvar_wire_set[2]; // transition variations related to wires, including TSVs
		
		void delete_var_list(Variation* variation); // delete a variation list
		void empty_var_set(std::map<std::string, Variation*>& var_set); // delete variation sets
	};

	std::array<std::string, NUM_BUF_VAR> skitter::buf_var_types = {{"LB", "VTH"}};
	std::array<std::string, NUM_WIRE_VAR> skitter::wire_var_types = {{"RW", "CW"}};
	std::array<std::string, NUM_TSV_VAR> skitter::tsv_var_types = {{"RT", "CT"}};
}



#endif /*SKITTER_H_*/
